<template>
  <div>
    <el-dialog
      v-if="showWin"
      v-dialogDrag="showWin"
      :title="formTitle"
      :close-on-click-modal="false"
      :visible.sync="showWin"
      width="60%">
      <el-form
        id="proForm"
        ref="proForm"
        :rules="rules"
        :model="form"
        label-width="auto">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="序号 :">
              <div>{{ form.seqNo }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电文代码 :">
              <div>{{ form.cableCode }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="电文内容 :">
              <pre>{{ form.content }}</pre>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状态 :">
              <div>{{ form.status }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发送时间 :">
              <div>{{ form.created }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="接收时间 :">
              <div>{{ form.receiveTime }}</div>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span
        slot="footer"
        class="dialog-footer">
        <el-button @click="showWin = false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import { deepClone } from '@/utils/index'

  export default {
    data() {
      return {
        rules: [],
        form: {},
        showWin: false,
        formTitle: '详情'
      }
    },
    methods: {
      show(data) {
        this.form = deepClone(data)
        this.form._content = this.form.content.replace(/(\r\n|\n|\r)/gm, '<br />')
        // const message = JSON.stringify(this.form.content)
        // this.form._content = JSON.parse(message.replace(/\n/g, '<br>'))
        this.showWin = true
      },
      closeWin() {
        this.showWin = false
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>
